<template>
  <div>
    <p>订单信息：</p>
    <p>地址：{{ itemInfoStore.orderInfo.address }}</p>
    <p>总价: {{ totalPrice }}</p>
  </div>
</template>

<script setup>
import { watch, ref } from 'vue';
import { useItemInfoStore } from '@/store/iteminfo';

const itemInfoStore = useItemInfoStore();
const itemList = itemInfoStore.orderInfo.itemList;
const totalPrice = ref(0)

watch(itemList, (itemList) => {
  itemList.forEach(item => {
    console.log(item)
    totalPrice.value += item.price * item.count
  })
})
</script>

<style scoped></style>